
// 参数1：buffer 字节数量
// 参数2：
// let buff = Buffer.alloc(10);
// console.log(buff); //<Buffer 00 00 00 00 00 00 00 00 00 00>

// let buff = Buffer.alloc(10,"abc");
// let buff = Buffer.alloc(10,"我爱祖国");
// console.log(buff);//<Buffer 61 61 61 61 61 61 61 61 61 61>


// 字符串->buffer
let buff2 = Buffer.from('我喜欢吃红烧肉');

console.log(buff2); //<Buffer e6 88 91 e5 96 9c e6 ac a2 e5 90 83 e7 ba a2 e7 83 a7 e8 82 89>

// buffer -> 字符串
let str = buff2.toString();

console.log(str); //我喜欢吃红烧肉

